package com.offcn.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: wy
 * @Date: 2022/9/23 17:36
 */
@RestController
public class SendController01 {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    /**
     * 点对点之间的 不需要交换机
     * @return
     */
    @RequestMapping("/send")
    public String send(){

        for (int i = 0; i < 10; i++) {
            rabbitTemplate.convertAndSend("test.queue","简单队列消息");
        }
        return "发送成功";
    }


}
